import request from "@/utils/request";

export function GetSystemMenuList(query) {
  return request({
    url: "/platform/menu/menuList",
    method: "get",
    params: { menuId: query }
  });
}

export function SaveSystemMenu(data) {
  return request({
    url: "/platform/menu/saveMenu",
    method: "post",
    data
  });
}

export function GetMenuButtonList(menuId) {
  return request({
    url: `/platform/menu/menuButtonList/${menuId}`,
    method: "get"
  });
}

export function GetRoleButtonList(menuId, roleId) {
  return request({
    url: `/platform/role/menuButtonList/${menuId}/${roleId}`,
    method: "get"
  });
}

export function SaveMenuButton(data) {
  return request({
    url: "/platform/menu/saveMenuButton",
    method: "post",
    data
  });
}

export function GetSystemRoleList() {
  return request({
    url: "/platform/role/roleList",
    method: "get"
  });
}

export function SaveSystemRole(data) {
  return request({
    url: "/platform/role/saveRole",
    method: "post",
    data
  });
}

export function GetRoleMenuList(query) {
  return request({
    url: "/platform/role/menuList",
    method: "get",
    params: query
  });
}

export function AddRoleMenuAuth(data) {
  return request({
    url: "/platform/role/saveRoleMenu",
    method: "post",
    data
  });
}

export function DeleteRoleMenuAuth(data) {
  return request({
    url: "/platform/role/deleteRoleMenu",
    method: "post",
    data
  });
}

export function AddRoleMenuButtonAuth(data) {
  return request({
    url: "/platform/role/saveRoleMenuButton",
    method: "post",
    data
  });
}

export function DeleteRoleMenuButtonAuth(data) {
  return request({
    url: "/platform/role/deleteRoleMenuButton",
    method: "post",
    data
  });
}

export function CreateUser(data) {
  return request({
    url: "/platform/user/createUser",
    method: "post",
    data
  });
}

export function GetSystemUserList() {
  return request({
    url: "/platform/user/userList",
    method: "get"
  });
}

export function AddUserRole(data) {
  return request({
    url: "/platform/user/addUserRole",
    method: "post",
    data
  });
}

export function DeleteUserRole(data) {
  return request({
    url: "/platform/user/deleteUserRole",
    method: "post",
    data
  });
}

export function GetUserRoleList(userId) {
  return request({
    url: `/platform/user/roleList/${userId}`,
    method: "get"
  });
}

export function DeleteMenuButton(data) {
  return request({
    url: "/platform/menu/deleteMenuButton",
    method: "post",
    data
  });
}

export function DeleteMenu(data) {
  return request({
    url: "/platform/menu/deleteMenu",
    method: "post",
    data
  });
}

export function SaveFlow(data) {
  return request({
    url: "/platform/flow/saveFlow",
    method: "post",
    data
  });
}

export function GetFlowList() {
  return request({
    url: "/platform/flow/flowList",
    method: "get"
  });
}

export function GetFlowNodeList(flowId) {
  return request({
    url: `/platform/flow/nodeList/${flowId}`,
    method: "get"
  });
}

export function SaveFlowNode(data) {
  return request({
    url: `/platform/flow/saveFlowNode`,
    method: "post",
    data
  });
}

export function GetFlowBindInfoList(flowId) {
  return request({
    url: `/platform/flow/bindInfoList/${flowId}`,
    method: "get"
  });
}

export function SaveFlowBindInfo(data) {
  return request({
    url: `/platform/flow/saveFlowBindInfo`,
    method: "post",
    data
  });
}

export function DeleteFlowBindInfo(bindId) {
  return request({
    url: `/platform/flow/deleteFlowBindInfo/${bindId}`,
    method: "get"
  });
}

export function GetFlowInstanceInfo(params) {
  return request({
    url: `/platform/flow/flowInstanceInfo`,
    method: "get",
    params: params
  });
}

export function GetFlowInstanceNextNode(params) {
  return request({
    url: `/platform/flow/flowInstanceNextNode`,
    method: "get",
    params: params
  });
}

export function SendFlow(data) {
  return request({
    url: `/platform/flow/sendFlow`,
    method: "post",
    data
  });
}

export function GetFlowOprateList(instanceId) {
  return request({
    url: `/platform/flow/flowOprateList/${instanceId}`,
    method: "get"
  });
}

export function GetFlowStep(flowId, instanceId) {
  return request({
    url: `/platform/flow/flowStep/${flowId}/${instanceId}`,
    method: "get"
  });
}

export function DeleteFlowParams(id) {
  return request({
    url: `/platform/flow/deleteFlowParams/${id}`,
    method: "get"
  });
}

export function SaveFlowParams(data) {
  return request({
    url: `/platform/flow/saveFlowParams`,
    method: "post",
    data
  });
}

export function GetFlowParamsList(flowId) {
  return request({
    url: `/platform/flow/flowParamsList/${flowId}`,
    method: "get"
  });
}

export function GetFlowNodeParamsList(flowId, nodeId) {
  return request({
    url: `/platform/flow/flowNodeParamsList/${flowId}/${nodeId}`,
    method: "get"
  });
}

export function SaveFlowNodeParams(data) {
  return request({
    url: `/platform/flow/saveFlowNodeParams`,
    method: "post",
    data
  });
}

export function DeleteFlowNodeParams(nodeId, paramsId) {
  return request({
    url: `/platform/flow/deleteFlowNodeParams/${nodeId}/${paramsId}`,
    method: "get"
  });
}

export function DeleteFlowNode(nodeId) {
  return request({
    url: `/platform/flow/deleteFlowNode/${nodeId}`,
    method: "get"
  });
}

export function GetSystemRoleGroupList() {
  return request({
    url: "/platform/role/roleGroupList",
    method: "get"
  });
}

export function SaveSystemRoleGroup(data) {
  return request({
    url: "/platform/role/saveRoleGroup",
    method: "post",
    data
  });
}

export function GetSystemRoleGroupItemList(roleId) {
  return request({
    url: `/platform/role/roleGroupItemList/${roleId}`,
    method: "get"
  });
}

export function SaveSystemRoleGroupItem(data) {
  return request({
    url: "/platform/role/saveRoleGroupItem",
    method: "post",
    data
  });
}

export function DeleteSystemRoleGroupItem(id) {
  return request({
    url: `/platform/role/delteRoleGroupItem/${id}`,
    method: "get"
  });
}

export function SaveBindFlow(data) {
  return request({
    url: "/platform/flow/addBindFlow",
    method: "post",
    data
  });
}

export function GetBindFlowList(flowId, nodeId) {
  return request({
    url: `/platform/flow/getBindFlowList/${flowId}/${nodeId}`,
    method: "get"
  });
}

// 系统电子签章配置
export function GetSignatureList(data) {
  return request({
    url: "/qiyuesuoinfo/list",
    method: "get",
    params: data
  });
}

// 系统电子签章配置新增及修改
export function SaveSignature(data) {
  return request({
    url: `/qiyuesuoinfo/${!data.id ? "save" : "update"}`,
    method: "post",
    data
  });
}

// 系统电子签章配置信息根据主键获取
export function geteSignature(id) {
  return request({
    url: `/qiyuesuoinfo/info/` + id,
    method: "get"
  });
}

// 系统电子签章配置信息删除
export function DelSignature(id) {
  return request({
    url: `/qiyuesuoinfo/delete/` + id,
    method: "get"
  });
}

// 系统电子签章配置可用状态码值
export function SignatureStatusToCh(value) {
  switch (value) {
    case 1:
      return "启用";
    case 0:
      return "禁用";
    default:
      return value;
  }
}

// 系统电子签章配置获取企业信息的下拉框数据
export function getFirmByJSFRole() {
  return request({
    url: "/enterprisecredit/getAllJSF",
    method: "get"
  });
}

// 重置密码
export function resetPass(data) {
  return request({
    url: "/platform/user/resetUserPassword/" + data,
    method: "get"
  });
}

